import fiftyone as fo
import fiftyone.brain as fob
import fiftyone.zoo as foz
from fiftyone import ViewField as F


# Create a dataset from a glob pattern of images
#dataset = fo.Dataset.from_images_patt("E:/VOCdevkit/VOC2012/JPEGImages/*.jpg")
dataset = fo.Dataset.from_images_patt('F:/1107/JPEGImages/*.jpg')

#dataset.name = "clustering_xag"
dataset.persistent = True
res = fob.compute_visualization(
    dataset,
    model="clip-vit-base32-torch",
    embeddings="clip_embeddings",
    method="umap",
    brain_key="clip_vis",
    batch_size=2
)
dataset.set_values("clip_umap", res.current_points)
session = fo.launch_app(dataset, port=8080)
session.wait()